package com.young.core.manager;

import com.young.core.domain.TriggerDO;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collection;

public interface TriggerManager {

    @Transactional
    void insert(TriggerDO trigger);

    /**
     * 获取尚未执行的trigger列表，即status = 0
     * @param ip
     * @return
     */
    @Transactional
    Collection<TriggerDO> getAll(String ip);

    @Transactional
    Collection<TriggerDO> getExpired(int ttl);

    @Transactional
    int update(TriggerDO trigger);

    @Transactional
    void delete(int id);

    @Transactional
    void delete(Collection<Integer> ids);

}
